<template>
    <div class="bg">
        <div class="container">
            <div class="row">
                <div class="col-md-8">
                    <div class="font-left">
                        <p>
                            <h1>智能简历分析系统</h1>
                        </p>

                        <p>
                            <h3>My dream is the starry sea, and you?</h3>
                        </p>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="t1">
                        <div class="dltop">
                                <h1 class="text-center">欢迎注册</h1>
                        </div>
                                <div>
                                    <form>
                                        <div class="row">
                                          <div class="col-md-2">
                                            <p class="text-center font-denglu">
                                                账号
                                            </p>
                                          </div>
                                          <div class="col-md-9">
                                            <input type="text" v-model="Username" class="form-control" placeholder="请输入账号">
                                          </div>
                                        </div>

                                        <div class="row">
                                            <div class="col-md-2">
                                              <p class="text-center font-denglu">
                                                  密码
                                              </p>
                                            </div>
                                            <div class="col-md-9">
                                              <input type="password" v-model="Password" class="form-control" placeholder="请输入密码">
                                            </div>
                                        </div> 
                                          <div class="col-md-12 text-center btn">
                                                <button type="button" class="btn btn-primary col-md-8 btn-r" @click="handleSubmit">注册</button>
                                          </div>                                       
                                      </form>
                                </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
</template>
<script >
import axios from 'axios';
import qs from 'qs';
import router from "@/router/index.js";
import { useRouter } from 'vue-router'
export default{
    data(){
        return{
            Username:'',
            Password:''
        }
    },
    methods: {
    async handleSubmit() {
        console.log(this.Username);
        console.log(this.Password);
        // let param=qs.Stringify
      // 使用Axios发送POST请求到Flask的/test路由
    //   http://26.188.105.114/resign/
      const response1=await axios.post('http://127.0.0.1:5000/resign/', {
            username: this.Username,
            password: this.Password
      }
      )
      console.log(response1.data);
      if(response1.data=="success"){
        alert("注册成功");
        router.push({name:"Login"})
      }else{
        alert("注册失败");
      }
  }
}}


    

</script>
<style>
 .bg{
                background-image: url(../../assets/images/2.jpeg);
                background-size: cover;
                background-repeat: no-repeat;
                background-attachment: fixed;
                width: 100%;
                height: 100%;
                position: fixed;
                /* 关键代码 */
                /* 相对于浏览器固定 */
                top: 0;
                /* 位置确定 */
                left: 0;
            }
            .t1{
                margin:100px 0 200px 0;
                height: 400px;
                border: 2px white;
                border-radius: 10%;
                background-color: rgba(193, 222, 226, 0.774);
                box-shadow: 10px 10px 10px 10px rgba(0, 0, 0, .3);
            }
            .font-left{
                color:white;
                text-align: center;
                margin:200px auto 200px auto;
            }
            .dltop{
                height: 120px;
                margin-top: 50px;
                margin-bottom: 10px;
            }
            .dltop h1{
                line-height: 120px;
            }
            .font-denglu{
                line-height: 38px;
                /* font-size: larger; */
                font-weight: bolder;
            }
            form{
                padding-left: 20px;
            }
            .row{
                margin-bottom: 8px;
                margin-top: 5px;
            }
            .btn-l{
                margin-right: 30px;
                /* margin-left: 20px; */
            }
            .btn-r{
                margin-left: 30px;
            }
            .btn{
                margin-top: 5px;
            }
</style>